<template>
	<view>
		<list>
			<!-- 注意事项: 不能使用 index 作为 key 的唯一标识 -->
			<cell v-for="(item, index) in dataList" :key="item.id" class="list_item"
			   @tap="courseDetail(index)">

				<image src="../../static/png_mryj.png"></image>
				<view class="right_div">
					<view>{{item.name}}</view>
					<view>{{item.name}}</view>
					<view class="bottom_div">
						<image src="../../static/xxjl_icon_time.png"></image>
						<text>{{item.examTime}}</text>
						<button>开始学习</button>
					</view>
				</view>

			</cell>
		</list>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: []
			}
		},
		// activated() {
		// 	this.getDataList()
		// },
		onReady:function(){
			uni.request({
				url: this.baseUrl+'getCourseByStuId', //仅为示例，并非真实接口地址。
				method:'POST',
				data: {
					stuId: uni.getStorageSync('uid')
				},
				header: {
					'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
				},
				success: (res) => {
					console.log(res);
					this.dataList=res.data.courseEntity;
					this.text = 'request success';
				}
			});
		},
		methods: {
			// 获取数据列表
			getDataList() {
			 
			},
			courseDetail:function(index){
				var id=this.dataList[index].id;
				//课程详情
				uni.navigateTo({
					url:'../mycourseDetail/mycourseDetail?id='+id+'&type=1'
				});
			}

		}
	}
</script>

<style>
	.list_item {
		display: flex;
		padding-top: 26rpx;
		padding-bottom: 26rpx;
		padding-left: 20rpx;
		padding-right: 20rpx;
		background: #FFFFFF;
	}

	.list_item image:nth-child(1) {
		height: 160rpx;
		width: 160rpx;
	}

	.list_item .right_div {
		margin-left: 20rpx;
		flex: 1;
		height: 160rpx;
	}

	.list_item .right_div view:nth-child(1) {
		color: #333333;
		font-size: 28rpx;
	}

	.list_item .right_div view:nth-child(2) {
		color: #999999;
		font-size: 24rpx;
		margin-top: 26px;
	}

	.list_item .right_div .bottom_div {
		display: flex;
		align-items: center;
		margin-top: 10rpx;
	}

	.list_item .right_div .bottom_div image {
		height: 20rpx;
		width: 20rpx;
	}

	.list_item .right_div .bottom_div text {
		color: #e1402e;
		font-size: 24rpx;
		flex: 1;
	}

	.list_item .right_div .bottom_div button {
		height: 50rpx;
		width: 120rpx;
		background: #fcebe9;
		border-radius: 25rpx;
		font-size: 22rpx;
		color: #e1402e;
	}
</style>
